<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>过线上除夕，包赛博饺砸</title>
    <script>
        function sendGetRequest(url, callback) {
            var xhr = new XMLHttpRequest();
            xhr.open("GET", url, true);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4 && xhr.status === 200) {
                    var response = JSON.parse(xhr.responseText);
                    callback(response);
                }
            };
            xhr.send();
        }

        // 使用示例
        var apiUrl = "/api/jinitaimei";
        function jinitaimei() {
            sendGetRequest(apiUrl, function (response) {
                console.log(response);
                if (response.code == 200) {
                    var element = document.getElementById("n");
                    element.innerHTML = "当前饺砸数：" + response.data;

                }
            });
        }
    </script>
</head>

<body>
    <h1>咱们一起，包~饺~砸！</h1>
    <h3 id="n">当前饺砸数：{$all}</h3>
    <button onclick="jinitaimei()">包饺砸</button>
</body>

</html>